package Formas;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

public class FormatoTablastatuscomisiones extends DefaultTableCellRenderer {

    public Component getTableCellRendererComponent(JTable table, Object value, boolean selected, boolean focused, int row, int column) {
        // SI EN CADA FILA DE LA TABLA LA CELDA 5 ES IGUAL A ACTIVO COLOR AZUL

        String cad=String.valueOf(table.getValueAt(row,0));
        if(cad.length()<6){
            setForeground(new java.awt.Color(0,102,0));
        }else{
            
        if (cad.substring(0,6).equals("   SC:")) {
            setForeground(Color.red);
            //setBackground(Color.WHITE);
            //setBackground(Color.yellow);
        } // SI NO ES ACTIVO ENTONCES COLOR ROJO
        else {
            setForeground(new java.awt.Color(0,102,0));
            //setBackground(Color.WHITE);
        }
        }
        
                
        
        super.getTableCellRendererComponent(table, value, selected, focused, row, column);
        return this;

    }
}